//
//  WHEnterpriseGovernmentCell.m
//  WHEasyBizLink
//
//  Created by shengmeng chen on 2024/12/4.
//

#import "WHEnterpriseGovernmentCell.h"
#import "WHEnterpriseGovernmentModel.h"
#import "UIView+Rounded.h"
#import "SDAutoLayout.h"

@implementation WHEnterpriseGovernmentCell

-(void)createUIControls
{
    [super createUIControls];
    
    _mbgView =[[UIView alloc] init];
    _mbgView.backgroundColor = [UIColor whiteColor];
    
    [self.contentView addSubview:self.mbgView];
    [UIView setViewRoundedWithRad:4 byRoundingCorners:UIRectCornerAllCorners view:self.mbgView];
    
    _micon = [[UIImageView alloc] init];
    [_micon setViewRoundedShadowWithRad:10 byRoundingCorners:UIRectCornerAllCorners];
    
    [self.mbgView addSubview:self.micon];
    self.micon.image = [UIImage imageNamed:@"busListCellbg"];
    
    /**  公司名称  **/
    UILabel*comNameLabel = [[UILabel alloc]init];
    comNameLabel.font = [UIFont systemFontOfSize:17*WidthScale>19?19:17*WidthScale];
    comNameLabel.textColor = RGBColor(80, 141, 201);;
    [self.mbgView addSubview:comNameLabel];
    comNameLabel.numberOfLines =0;
    _comNameLabel = comNameLabel;
    
//    /**   信用代码  **/
//    UILabel*creditNameLabel = [[UILabel alloc]init];
//    creditNameLabel.font = [UIFont systemFontOfSize:15];
//    creditNameLabel.textColor =RGBColor(134, 171, 208);
//    [self.mbgView addSubview:creditNameLabel];
//    creditNameLabel.numberOfLines =0;
//    creditNameLabel.text = @"信用代码:";
//    _creditNameLabel = creditNameLabel;
//    
//    /**   法人姓名  **/
//    UILabel*legalNameLabel = [[UILabel alloc]init];
//    legalNameLabel.font = [UIFont systemFontOfSize:15];
//    legalNameLabel.textColor =RGBColor(134, 171, 208);
//    [self.mbgView addSubview:legalNameLabel];
//    legalNameLabel.numberOfLines =0;
//    legalNameLabel.text = @"法人姓名:";
//    _legalNameLabel = legalNameLabel;
//    
//    /**   创建日期  **/
//    UILabel*creatDateLabel = [[UILabel alloc]init];
//    creatDateLabel.font = [UIFont systemFontOfSize:15];
//    creatDateLabel.textColor =RGBColor(134, 171, 208);
//    [self.mbgView addSubview:creatDateLabel];
//    creatDateLabel.numberOfLines =0;
//    creatDateLabel.text = @"创建日期:";
//    _creatDateLabel = creatDateLabel;
    
    /**   企业地址  **/
    UILabel*addresNameLabel = [[UILabel alloc]init];
    addresNameLabel.font = [UIFont systemFontOfSize:15];
    addresNameLabel.textColor =RGBColor(134, 171, 208);
    [self.mbgView addSubview:addresNameLabel];
    addresNameLabel.numberOfLines =0;
    addresNameLabel.text = @"信用代码:";
    _addresNameLabel = addresNameLabel;
    
}

-(void)setUpUIControlsLayout
{
    [super setUpUIControlsLayout];
    
    _mbgView
    .sd_layout
    .topSpaceToView(self.contentView, 10)
    .bottomSpaceToView(self.contentView, 10)
    .leftSpaceToView(self.contentView, 20)
    .rightSpaceToView(self.contentView,20);

    _micon
    .sd_layout
    .topSpaceToView(self.mbgView, 5)
    .bottomSpaceToView(self.mbgView,5)
    .leftSpaceToView(self.mbgView, 5)
    .rightSpaceToView(self.mbgView,5);
    
    /**  公司名称  **/
    _comNameLabel.sd_layout.
    topSpaceToView(self.mbgView,kMarginH*2)
    .leftSpaceToView(self.mbgView,kMarginW*2)
    .rightSpaceToView(self.mbgView,kMarginW)
    .autoHeightRatio(0);
    
//    /**   信用代码  **/
//    _creditNameLabel.sd_layout.
//    topSpaceToView(self.comNameLabel,kMarginH)
//    .leftSpaceToView(self.mbgView,kMarginW*2)
//    .rightSpaceToView(self.mbgView,kMarginW*2)
//    .autoHeightRatio(0);
//    
//    
//    /**   法人姓名  **/
//    _legalNameLabel.sd_layout.
//    topSpaceToView(self.creditNameLabel,kMarginH)
//    .leftSpaceToView(self.mbgView,kMarginW*2)
//    .rightSpaceToView(self.mbgView,kMarginW*2)
//    .autoHeightRatio(0);
//    
//    /**   创建日期  **/
//    _creatDateLabel.sd_layout.
//    topSpaceToView(self.legalNameLabel,kMarginH)
//    .leftSpaceToView(self.mbgView,kMarginW*2)
//    .rightSpaceToView(self.mbgView,kMarginW*2)
//    .autoHeightRatio(0);
    
    /**   企业地址  **/
    _addresNameLabel.sd_layout.
    topSpaceToView(self.comNameLabel,kMarginH)
    .leftSpaceToView(self.mbgView,kMarginW*2)
    .rightSpaceToView(self.mbgView,kMarginW*2)
    .autoHeightRatio(0);

}

-(void)setModel:(WHEnterpriseGovernmentModel *)model
{
    _model = model;
    
    _comNameLabel.text    =  model.comName;
    /**   信用代码  **/
    _creditNameLabel.text =[NSString stringWithFormat:@"信用代码:  %@",model.creditName];
    /**   法人姓名  **/
    _legalNameLabel.text  =[NSString stringWithFormat:@"法人姓名:  %@",model.legalName];
    /**   创建日期  **/
    _creatDateLabel.text  =[NSString stringWithFormat:@"创建日期:  %@",model.creatDate];
    /**   企业地址  **/
    _addresNameLabel.text =[NSString stringWithFormat:@"政府地址:  %@",model.addresName];
    
    
    if (model.isRun==YES) {
        _comNameLabel.textColor    = RGBColor(80, 141, 201);
        _creditNameLabel.textColor =RGBColor(134, 171, 208);
        _legalNameLabel.textColor  =RGBColor(134, 171, 208);
        _creatDateLabel.textColor  =RGBColor(134, 171, 208);
        _addresNameLabel.textColor =RGBColor(134, 171, 208);
    }else
    {
        _comNameLabel.textColor    =[UIColor lightGrayColor];
        _creditNameLabel.textColor =[UIColor lightGrayColor];
        _legalNameLabel.textColor  =[UIColor lightGrayColor];
        _creatDateLabel.textColor  =[UIColor lightGrayColor];
        _addresNameLabel.textColor =[UIColor lightGrayColor];
    }
    
}

@end
